<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />









  <meta name="baidu-site-verification" content="Q7ugSRSO7V" />







  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Hexo, NexT" />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="判断客户端编码public static function get_os($agent = null) &amp;#123;        if (!$agent) $agent = $_SERVER[&apos;HTTP_USER_AGENT&apos;];        if (preg_match(&apos;/win/i&apos;, $agent) &amp;amp;&amp;amp; preg_match(&apos;/nt 6.0/i&apos;, $agent))">
<meta property="og:type" content="article">
<meta property="og:title" content="header">
<meta property="og:url" content="http://yoursite.com/http/header/index.html">
<meta property="og:site_name" content="chimps">
<meta property="og:description" content="判断客户端编码public static function get_os($agent = null) &amp;#123;        if (!$agent) $agent = $_SERVER[&apos;HTTP_USER_AGENT&apos;];        if (preg_match(&apos;/win/i&apos;, $agent) &amp;amp;&amp;amp; preg_match(&apos;/nt 6.0/i&apos;, $agent))">
<meta property="og:updated_time" content="2017-04-23T14:49:57.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="header">
<meta name="twitter:description" content="判断客户端编码public static function get_os($agent = null) &amp;#123;        if (!$agent) $agent = $_SERVER[&apos;HTTP_USER_AGENT&apos;];        if (preg_match(&apos;/win/i&apos;, $agent) &amp;amp;&amp;amp; preg_match(&apos;/nt 6.0/i&apos;, $agent))">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"hide","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":30},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/http/header/"/>





  <title> header | chimps </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?dcb994042608bdb310eff950ba755ff1";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>










  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">chimps</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/http/header/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="chimps">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="https://sfault-avatar.b0.upaiyun.com/416/326/4163260007-58a1621e63a68_huge256">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="chimps">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                header
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-04-23T22:48:53+08:00">
                2017-04-23
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/http/" itemprop="url" rel="index">
                    <span itemprop="name">http</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a class="cloud-tie-join-count" href="/http/header/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count join-count" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="判断客户端编码"><a href="#判断客户端编码" class="headerlink" title="判断客户端编码"></a>判断客户端编码</h1><figure class="highlight php"><table><tr><td class="code"><pre><div class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="function"><span class="keyword">function</span> <span class="title">get_os</span><span class="params">($agent = null)</span> </span>&#123;</div><div class="line">        <span class="keyword">if</span> (!$agent) $agent = $_SERVER[<span class="string">'HTTP_USER_AGENT'</span>];</div><div class="line">        <span class="keyword">if</span> (preg_match(<span class="string">'/win/i'</span>, $agent) &amp;&amp; preg_match(<span class="string">'/nt 6.0/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'Windows Vista'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/win/i'</span>, $agent) &amp;&amp; preg_match(<span class="string">'/nt 6.1/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'Windows 7'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/win/i'</span>, $agent) &amp;&amp; preg_match(<span class="string">'/nt 6.2/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'Windows 8'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/win/i'</span>, $agent) &amp;&amp; preg_match(<span class="string">'/nt 10.0/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'Windows 10'</span>;<span class="comment"># 添加win10判断</span></div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/win/i'</span>, $agent) &amp;&amp; preg_match(<span class="string">'/nt 5.1/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'Windows XP'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/win/i'</span>, $agent) &amp;&amp; preg_match(<span class="string">'/nt 5/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'Windows 2000'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/win/i'</span>, $agent) &amp;&amp; preg_match(<span class="string">'/nt/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'Windows NT'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/win/i'</span>, $agent) &amp;&amp; preg_match(<span class="string">'/32/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'Windows 32'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/linux/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'Linux'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/unix/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'Unix'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/sun/i'</span>, $agent) &amp;&amp; preg_match(<span class="string">'/os/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'SunOS'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/ibm/i'</span>, $agent) &amp;&amp; preg_match(<span class="string">'/os/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'IBM OS/2'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/Mac/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'Macintosh'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/PowerPC/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'PowerPC'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/AIX/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'AIX'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/HPUX/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'HPUX'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/NetBSD/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'NetBSD'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/BSD/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'BSD'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/OSF1/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'OSF1'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/IRIX/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'IRIX'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/FreeBSD/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'FreeBSD'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/teleport/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'teleport'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/flashget/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'flashget'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/webzip/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'webzip'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (preg_match(<span class="string">'/offline/i'</span>, $agent)) &#123;</div><div class="line">            $os = <span class="string">'offline'</span>;</div><div class="line">        &#125; <span class="keyword">else</span> &#123;</div><div class="line">            $os = <span class="string">'未知操作系统'</span>;</div><div class="line">        &#125;</div><div class="line">        <span class="keyword">return</span> $os;</div><div class="line">    &#125;</div></pre></td></tr></table></figure>
<h1 id="页面输出"><a href="#页面输出" class="headerlink" title="页面输出"></a>页面输出</h1><figure class="highlight php"><table><tr><td class="code"><pre><div class="line">header(<span class="string">'HTTP/1.1 200 OK'</span>);  <span class="comment">// ok 正常访问</span></div><div class="line">header(<span class="string">'HTTP/1.1 404 Not Found'</span>); <span class="comment">//通知浏览器 页面不存在</span></div><div class="line">header(<span class="string">'HTTP/1.1 301 Moved Permanently'</span>); <span class="comment">//设置地址被永久的重定向 301</span></div><div class="line">header(<span class="string">'Location: http://www.form1.cn/'</span>); <span class="comment">//跳转到一个新的地址</span></div><div class="line">header(<span class="string">'Refresh: 10; url=http://www.form1.cn/'</span>); <span class="comment">//延迟转向 也就是隔几秒跳转</span></div><div class="line">header(<span class="string">'X-Powered-By: PHP/6.0.0'</span>); <span class="comment">//修改 X-Powered-By信息</span></div><div class="line">header(<span class="string">'Content-language: en'</span>); <span class="comment">//文档语言</span></div><div class="line">header(<span class="string">'Content-Length: 1234'</span>); <span class="comment">//设置内容长度</span></div><div class="line">header(<span class="string">'Last-Modified: '</span>.gmdate(<span class="string">'D, d M Y H:i:s'</span>, $time).<span class="string">' GMT'</span>); <span class="comment">//告诉浏览器最后一次修改时间</span></div><div class="line">header(<span class="string">'HTTP/1.1 304 Not Modified'</span>); <span class="comment">//告诉浏览器文档内容没有发生改变</span></div></pre></td></tr></table></figure>
<h1 id="内容输出"><a href="#内容输出" class="headerlink" title="内容输出"></a>内容输出</h1><figure class="highlight php"><table><tr><td class="code"><pre><div class="line">header(<span class="string">'Content-Type: text/html; charset=utf-8'</span>); <span class="comment">//网页编码 </span></div><div class="line">header(<span class="string">'Content-Type: text/plain'</span>); <span class="comment">//纯文本格式 </span></div><div class="line">header(<span class="string">'Content-Type: image/jpeg'</span>); <span class="comment">//JPG、JPEG  </span></div><div class="line">header(<span class="string">'Content-Type: application/zip'</span>); <span class="comment">// ZIP文件 </span></div><div class="line">header(<span class="string">'Content-Type: application/pdf'</span>); <span class="comment">// PDF文件 </span></div><div class="line">header(<span class="string">'Content-Type: audio/mpeg'</span>); <span class="comment">// 音频文件  </span></div><div class="line">header(<span class="string">'Content-type: text/css'</span>); <span class="comment">//css文件</span></div><div class="line">header(<span class="string">'Content-type: text/javascript'</span>); <span class="comment">//js文件</span></div><div class="line">header(<span class="string">'Content-type: application/json'</span>);  <span class="comment">//json</span></div><div class="line">header(<span class="string">'Content-type: application/pdf'</span>); <span class="comment">//pdf </span></div><div class="line">header(<span class="string">'Content-type: text/xml'</span>);  <span class="comment">//xml</span></div><div class="line">header(<span class="string">'Content-Type: application/x-shockw**e-flash'</span>); <span class="comment">//Flash动画</span></div></pre></td></tr></table></figure>
<h1 id="声明一个下载文件"><a href="#声明一个下载文件" class="headerlink" title="声明一个下载文件"></a>声明一个下载文件</h1><figure class="highlight php"><table><tr><td class="code"><pre><div class="line">header(<span class="string">'Content-Type: application/octet-stream'</span>); </div><div class="line">header(<span class="string">'Content-Disposition: attachment; filename="ITblog.zip"'</span>); </div><div class="line">header(<span class="string">'Content-Transfer-Encoding: binary'</span>); </div><div class="line">readfile(<span class="string">'test.zip'</span>);</div></pre></td></tr></table></figure>
<h1 id="对当前文档禁用缓存"><a href="#对当前文档禁用缓存" class="headerlink" title="对当前文档禁用缓存"></a>对当前文档禁用缓存</h1><figure class="highlight php"><table><tr><td class="code"><pre><div class="line">header(<span class="string">'Cache-Control: no-cache, no-store, max-age=0, must-revalidate'</span>); </div><div class="line">header(<span class="string">'Expires: Mon, 26 Jul 1997 05:00:00 GMT'</span>);</div></pre></td></tr></table></figure>
<h1 id="身份认证"><a href="#身份认证" class="headerlink" title="身份认证"></a>身份认证</h1><figure class="highlight php"><table><tr><td class="code"><pre><div class="line">header(<span class="string">'HTTP/1.1 401 Unauthorized'</span>);  </div><div class="line">header(<span class="string">'WWW-Authenticate: Basic realm="Top Secret"'</span>);</div></pre></td></tr></table></figure>
<h1 id="声明一个需要下载的xls文件"><a href="#声明一个需要下载的xls文件" class="headerlink" title="声明一个需要下载的xls文件"></a>声明一个需要下载的xls文件</h1><figure class="highlight php"><table><tr><td class="code"><pre><div class="line">header(<span class="string">'Content-Disposition: attachment; filename=ithhc.xlsx'</span>);</div><div class="line">header(<span class="string">'Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'</span>);</div><div class="line">header(<span class="string">'Content-Length: '</span>.filesize(<span class="string">'./test.xls'</span>));  </div><div class="line">header(<span class="string">'Content-Transfer-Encoding: binary'</span>);  </div><div class="line">header(<span class="string">'Cache-Control: must-revalidate'</span>);  </div><div class="line">header(<span class="string">'Pragma: public'</span>);  </div><div class="line">readfile(<span class="string">'./test.xls'</span>);</div></pre></td></tr></table></figure>
<h1 id="download"><a href="#download" class="headerlink" title="download"></a>download</h1><figure class="highlight php"><table><tr><td class="code"><pre><div class="line">header(<span class="string">"Content-type: application/force-download"</span>);</div><div class="line"><span class="comment">// 判断编码</span></div><div class="line">$use_utf_8 = Utils::get_os() == <span class="string">'Macintosh'</span>;</div><div class="line"><span class="keyword">if</span> (!$use_utf_8) &#123;</div><div class="line">    <span class="comment">// Disposition中文是处置的意思, 可以理解为文档如何处置</span></div><div class="line">    header(<span class="string">"Content-Disposition: attachment;filename="</span> . iconv(<span class="string">"utf-8"</span>, <span class="string">"gb2312//IGNORE"</span>, $zip_title) . <span class="string">".zip"</span>);</div><div class="line">&#125; <span class="keyword">else</span> &#123;</div><div class="line">    header(<span class="string">"Content-Disposition: attachment;filename="</span> . $zip_title . <span class="string">".zip"</span>);</div><div class="line">&#125;</div><div class="line"><span class="keyword">echo</span> file_get_contents($zip_path);</div></pre></td></tr></table></figure>
      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/security/公钥与私钥/" rel="next" title="公钥与私钥">
                <i class="fa fa-chevron-left"></i> 公钥与私钥
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/http/参数/" rel="prev" title="参数">
                参数 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="cloud-tie-wrapper" class="cloud-tie-wrapper"></div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="https://sfault-avatar.b0.upaiyun.com/416/326/4163260007-58a1621e63a68_huge256"
               alt="chimps" />
          <p class="site-author-name" itemprop="name">chimps</p>
           
              <p class="site-description motion-element" itemprop="description"></p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">59</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">12</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">19</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#判断客户端编码"><span class="nav-number">1.</span> <span class="nav-text">判断客户端编码</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#页面输出"><span class="nav-number">2.</span> <span class="nav-text">页面输出</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#内容输出"><span class="nav-number">3.</span> <span class="nav-text">内容输出</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#声明一个下载文件"><span class="nav-number">4.</span> <span class="nav-text">声明一个下载文件</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#对当前文档禁用缓存"><span class="nav-number">5.</span> <span class="nav-text">对当前文档禁用缓存</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#身份认证"><span class="nav-number">6.</span> <span class="nav-text">身份认证</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#声明一个需要下载的xls文件"><span class="nav-number">7.</span> <span class="nav-text">声明一个需要下载的xls文件</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#download"><span class="nav-number">8.</span> <span class="nav-text">download</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">chimps</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  








  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  


  




	





  
    
    <script>
      var cloudTieConfig = {
        url: document.location.href, 
        sourceId: "",
        productKey: "48bb30d8783d4b38ba0c95e0283238ca",
        target: "cloud-tie-wrapper"
      };
    </script>
    <script src="https://img1.ws.126.net/f2e/tie/yun/sdk/loader.js"></script>
  










  





  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  

  

  

</body>
</html>
